package reflect.test;

import cachemanager.EhCache;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * Created by luoqifei on 17-7-3.
 */
public class reflectCase {
    public static void main(String args[]) throws NoSuchFieldException, IllegalAccessException {
        Class clas = EhCache.class;
        System.out.println(clas.getName());
        for (int i = 0; i < clas.getMethods().length; i++) {
            System.out.println(clas.getMethods()[i]);
        }
        System.out.println(Modifier.isFinal(clas.getModifiers()));
        System.out.println(clas.getPackage());
        System.out.println(clas.getSuperclass());
        System.out.println(clas.getSimpleName());
        System.out.println(clas.getField("defaultConf").getName());
        EhCache ehCache = new EhCache();
        Field field = clas.getDeclaredField("priNum");
        field.setAccessible(true);
        System.out.println(field.get(ehCache));
        for (int i = 0; i < clas.getFields().length; i++) {
            System.out.println(clas.getFields()[i].getName());
        }
    }
}
